home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 12 / BBS in a box XII-1.iso / Files / System7 tools / A / AETracker2.0.sit / Read Me • AETracker / Read Me • AETracker
Encoding:
Text File  |  1992-04-13  |  9.3 KB  |  178 lines  |  [ttro/ttxt]

  1. AETracker v 2.0
  2. C.K. Haun <TR>
  3. RavenWare Software
  4. 22045 McClellan Rd.
  5. Cupertino, CA 95014
  6. ALink - C.K.HAUN
  7. GEnie - C.Haun1
  8. CIS - 75300,1001
  9.  
  10. The Problems:
  11. What's going wrong in my AppleEvent routines?!?!?!?
  12. The Solution:
  13. AETracker!
  14. AETracker is an INIT/CDev that allows you to log AppleEvent activity on your system.  You can watch as much or as little AppleEvent manager (AEM) information as you like, and pull a little info or a lot of information about what's happening.
  15. AETracker provides many levels of tracking, fully user  configurable.
  16.  
  17. AETracker lets you track the inputs and outputs to all your AEM calls, and will show you exactly where errors are occurring.
  18.  
  19. Another very helpful use for AETracker is to sno0p other people's applications, you can get a full track of what AEM activity other applications are doing.
  20.  
  21. Enough market hype, here's the details.....
  22.  
  23. AETracker patches four traps, PostEvent, GetNextEvent, Close, and Pack8 (the AEM trap).
  24.  
  25. The first three are "housekeeping" patches for AETracker, mainly they let the CDEV and you talk to the INIT.
  26.  
  27. The PostEvent patch watches for the 'toggle' key sequence.  You can set any single key + all modifiers as the toggle to turn AETracker on and off.  Be SURE that you are not using that keystroke in another INIT or Application, since AETracker will eat the
  28. event when it sees it, or alternately another INIT may already have
  29. eaten it.  
  30. The PostEvent patch also looks for an event posted by the CDEV that tells it to reload the CDEV resources, that's how you can change AETracker's settings without rebooting the machine.  
  31.  
  32. The GetNextEvent patch looks for flags that the PostEvent patch sets,  and does things based on the flag, since GNE is memory moving safe and PostEvent ain't.
  33.  
  34. The Close patch is designed to keep the AETrack file open until you close it, despite ExitToShell trying to close the file when the app that was frontmost when it was created quits.
  35. • Note:  Because the Close patch exists, you have to _explicitly_ tell AETracker to turn itself off.  That's why the flashing indicator in the menu bar exists, to let you know that AETracker is still running, so you don't end up with a lot bigger track file than you anticipated.
  36.  
  37. The Pack8 patch is where the real business happens;
  38.  
  39. When AETracker is toggled on, here's what happens....
  40. A work file is opened, it will be named "AETrackXXXX" where 
  41. XXXX is Ticks at toggle time (creative, huh?).  This file will always be
  42. created in the Control Panels folder until you set a different directory with the button in the Control Panel. 
  43. • Note:  In the unlikely instance that there is already a file named AETrack-XXXX in the control panels folder, AETracker will increment the first letter of the name until it can create the file, so you'll get things like BETrack-XXXX, CETrack-XXXX.  
  44. It may seem like that'll never happen, but I've done it twice during debugging.  
  45. You can change the file name by modifying 'STR ' resource -4064, but
  46. whatever you change it to will still have the XXXX appended to it.
  47.  
  48.  
  49. The Pack8 (AppleEvent manager) patch is enabled.  Depending on the
  50. myriad settings you can make, that patch will start writing data
  51. to the work file.
  52.  
  53. AppleEvent traffic happens, and a nice log is written out.
  54. The log will contain information about which routine was called, what application called it, when (in ticks) it was called, what parameters were passed to it, and what parameters were returned.  Again, the amount of info in the log will depend on the settings you give the the Control Panel.
  55. Also, a small black circle will flash in the right side of the menu bar, so you can tell that AETracker is tracking.
  56.  
  57. Here's a small sample, taken from a log of my AEObject sample
  58.  
  59. AEObject-Edition Sample at TickCount: 143836
  60. AEDisposeDesc
  61.  Descriptor Type:long
  62. AEObject-Edition Sample at TickCount: 143836
  63. AECoerceDesc
  64.  Coercing from :reco to obj 
  65. AEObject-Edition Sample at TickCount: 143837
  66. AEDisposeDesc
  67.  Descriptor Type:reco
  68.  
  69.  
  70.  
  71. There are some machine cycles involved in all this.  I'm head and tail patching Pack8, writing a lot of junk out to disk, and doing a lot of analysis of the data passed to the AEM on every AEM trap call.
  72. I wrote AETracker in assembly to speed it up as much as I could, but
  73. that still involves some time.  And, since I don't know what you're debugging on, I had to stick with 68000 opcodes. Its fast, but not as fast as if it wasn't there at all.  
  74.  
  75. Eventually you get all the info you need and you toggle AETracker off.
  76. The work file is closed, the Close and Pack8 patches are deactivated, 
  77. and AETracker waits for another toggle.
  78.  
  79. You go read the track file (it's type TEXT) and are greatly impressed and
  80. find all the AE bugs in your program,  recode everything,  go
  81. golden master 3 weeks early, sell 1000000000 copies of your application, and
  82. give me 10% royalties.
  83.  
  84. Well, hopefully the information will help.
  85.  
  86. The Settings
  87. • Note:  Changes to settings take effect as soon as the Control Panel is closed (you do NOT have to reboot!), so you can change your configuration and be testing again quickly.  
  88.  
  89. Toggle Key
  90. This is the key that turns AETracker on and off.  It's a single key stroke with any combination of the 4 modifier keys down.  Again, make sure that this key setting doesn't conflict with any other INITs (like SwitchApp, another fine RavenWare INIT) or whatever you have installed, since I zero out the event after I see it.
  91.  
  92. Tracking
  93. These two radio buttons tell AETracker what application it should care
  94. about.  You have two choices, All Applications or Frontmost Only.
  95. If you select All Applications, then AETracker records AE info happening
  96. anywhere on your system.
  97. If you select Frontmost Only, AETracker only will record AE action for
  98. the application that is frontmost WHEN AETracker IS TURNED ON!
  99. If that application subsequently goes into the background, AETracker
  100. WILL STILL TRACK IT AND ONLY IT!  I like this a lot.
  101. Of course, if the application that you started AETracker in quits, it's PSN doesn't exists anymore.  I am NOT checking for this, AETracker will just not be recording any information any more, even though it's still active.
  102.  
  103. Routine Selection
  104. There are three radio buttons that let you set how much of the AEM stuff 
  105. going on you want to know about.  The first button "Every Danged Thing" does just what it says.  It will track information on all 53 AEM calls AND the 7 Object Support Library routines I know about.  
  106. This gives you a full log of information, and is REALLY neat.
  107.  
  108. The second, Limited, tracks only AESend and AEProcessAppleEvent.  This is a good place to start, to give you a rough idea of what is going on in your system.
  109.  
  110. "Let Me pick 'em" introduces you to more radio buttons than you ever wanted to
  111. see.  But it also gives you a great deal of control.  The dialog that comes up lets you specify exactly which calls you want to track, if you KNOW that there's a problem in AEGetKeyPtr you can track just that.
  112. And if anyone can come up with a better way to do this than 50ish checkboxes, 
  113. let me know.  But NOT popup menus, that would be worse, OK?
  114.  
  115. Information Selection
  116. There are three information level settings you can pick.
  117.  
  118. "Minimum" gives you just routine name, application name, and tick count.
  119.  
  120. "More" gives you the above and information about the parameters passed to the AEM routine.  It will also dump some of the data passed to some routines (AEPutParamPtr, for example).  It dumps only 40 bytes of the data.  Is that enough?  Would you like to see more?  Let me know.
  121.  
  122. "A great deal of information"  head and tail-patches Pack8, and gives you everything that "More" does, plus reports on any errors and gives you details about the paramters returned from a call.
  123.  
  124.  
  125. Supporting Players:
  126. There is one resource you may want to play with, the FTYP resource.  This is the creator of the track file I create.  I have it set so the creator is MPW, you can change this to whatever you want to read the file in.  The file will _always_ be created as a text file.
  127.  So why isn't the resource named CTYP?  Because I'm goofy.
  128.  
  129.  
  130.  
  131. Wish I knew how:
  132. How can I tell when an AEM routine is being called by the OSL?  I'd like to ignore those, but since the OSL is linked into the application I can't differentiate OSL AEM calls from App OSL calls, since they come from the same zone.  Any hints?
  133.  
  134. What are those unknown selectors the OSL is using????
  135.  
  136.  
  137. I hope you find AETracker useful.  I know I do, I have debugged several problems already because I wrote this.
  138. Any comments, suggestions, or additions you have please send along to me, I'll try and implement them.
  139. Please also send me the shareware fee ($5, c'mon).
  140.  
  141. C.K. Haun
  142. January 1992
  143.  
  144. beta 1
  145. • Initial release
  146.  
  147. beta 2  Feb 92
  148. • Fixed small startup bug.
  149. • Unrolled a few loops
  150.  
  151. beta 3 changes Mar 92
  152. • Finally added a path selection button for the output file, argued with
  153.   the Alias Manager for a while about what a d*mned folder alias really means 
  154. • got rid of spurious alert when you cancel out of custom selector list
  155.  
  156. Version 2 changes April 92
  157. • Changed some more code to make things go even faster
  158. • Added tail-patch code. AETracker will now report result of calls, error and
  159.   parameter returns (Yaaaa!).
  160. • Added cheezy help dialog.
  161. • Projectorized the whole thing, for reasons that are unclear to me but I thought it 
  162.    might be fun to play with Projector.  I was wrong.
  163. • Increased amount of data given from some calls.
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174. Written under the
  175. FredWare principle;
  176. If you don't like it
  177. Write a better one yourself!
  178.